<?php
class MyZend_View_Helper_MyLinkSort extends Zend_View_Helper_Abstract {
	public function myLinkSort($label, $colum, $ssFilter, $imgLink, $actionLink, $default_order = 'DESC') {
		
		// if colum is differen colum is ordering, no image icon
		if($ssFilter['col'] != $colum) {
			$linkOrder = $actionLink . '/col/' . $colum . '/by/' . $default_order;
			$xhtml     = '<a href="' . $linkOrder . '" title="Sort Z-A">' . $label . '</a>';
		}else {
			if($ssFilter['order'] == 'DESC') {
				$sortOrder = 'ASC';
				$iconSort  = $imgLink . '/arrow_down.png';
				$title     = "Sort A-Z";
			}else {
				$sortOrder = 'DESC';
				$iconSort  = $imgLink . '/arrow_up.png';
				$title     = "Sort Z-A";
			}
			
			$linkOrder = $actionLink . '/col/' . $colum . '/by/' . $sortOrder;
			
			$xhtml = '<a href="' . $linkOrder . '" title="' . $title . '">
			            ' . $label . '
			             <br>
			          <img src="' . $iconSort .'">
		         	 </a>';
		}
		
		return $xhtml;
	}
}